.TH "NETCONF rpc" 3 "Fri Apr 15 2016" "Version 0.10.0-146_trunk" "libnetconf" \" -*- nroff -*-
.ad l
.nh
.SH NAME
NETCONF rpc \- 
.PP
libnetconf's functions for handling NETCONF <rpc> messages\&.  

.SS "Typedefs"

.in +1c
.ti -1c
.RI "typedef struct nc_msg \fBnc_rpc\fP"
.br
.RI "\fIrpc message\&. \fP"
.in -1c
.SS "Enumerations"

.in +1c
.ti -1c
.RI "enum \fBNC_CAP_ATTR\fP { \fBNC_CAP_ATTR_WITHDEFAULTS_MODE\fP = 1 }"
.br
.RI "\fIRPC attributes list\&. \fP"
.ti -1c
.RI "enum \fBNC_EDIT_DEFOP_TYPE\fP { \fBNC_EDIT_DEFOP_ERROR\fP = -1, \fBNC_EDIT_DEFOP_NOTSET\fP = 0, \fBNC_EDIT_DEFOP_MERGE\fP = 1, \fBNC_EDIT_DEFOP_REPLACE\fP = 2, \fBNC_EDIT_DEFOP_NONE\fP = 3 }"
.br
.RI "\fIEnumeration of edit-config's <default-operation> element values\&. \fP"
.ti -1c
.RI "enum \fBNC_EDIT_ERROPT_TYPE\fP { \fBNC_EDIT_ERROPT_ERROR\fP = -1, \fBNC_EDIT_ERROPT_NOTSET\fP = 0, \fBNC_EDIT_ERROPT_STOP\fP = 1, \fBNC_EDIT_ERROPT_CONT\fP = 2, \fBNC_EDIT_ERROPT_ROLLBACK\fP = 3 }"
.br
.RI "\fIEnumeration of edit-config's <error-option> element values\&. \fP"
.ti -1c
.RI "enum \fBNC_EDIT_OP_TYPE\fP { \fBNC_EDIT_OP_ERROR\fP = -1, \fBNC_EDIT_OP_MERGE\fP = 1, \fBNC_EDIT_OP_NOTSET\fP = 0, \fBNC_EDIT_OP_REPLACE\fP = 2, \fBNC_EDIT_OP_CREATE\fP, \fBNC_EDIT_OP_DELETE\fP, \fBNC_EDIT_OP_REMOVE\fP }"
.br
.RI "\fIEnumeration of edit-config's operation attribute values\&. \fP"
.ti -1c
.RI "enum \fBNC_EDIT_TESTOPT_TYPE\fP { \fBNC_EDIT_TESTOPT_ERROR\fP = -1, \fBNC_EDIT_TESTOPT_NOTSET\fP = 0, \fBNC_EDIT_TESTOPT_TESTSET\fP = 1, \fBNC_EDIT_TESTOPT_SET\fP = 2, \fBNC_EDIT_TESTOPT_TEST\fP = 3 }"
.br
.RI "\fIEnumeration of edit-config's <test-option> element values\&. \fP"
.ti -1c
.RI "enum \fBNC_FILTER_TYPE\fP { \fBNC_FILTER_UNKNOWN\fP, \fBNC_FILTER_SUBTREE\fP }"
.br
.RI "\fIEnumeration of supported NETCONF filter types\&. \fP"
.ti -1c
.RI "enum \fBNC_OP\fP { \fBNC_OP_UNKNOWN\fP, \fBNC_OP_GETCONFIG\fP, \fBNC_OP_GET\fP, \fBNC_OP_EDITCONFIG\fP, \fBNC_OP_CLOSESESSION\fP, \fBNC_OP_KILLSESSION\fP, \fBNC_OP_COPYCONFIG\fP, \fBNC_OP_DELETECONFIG\fP, \fBNC_OP_LOCK\fP, \fBNC_OP_UNLOCK\fP, \fBNC_OP_COMMIT\fP, \fBNC_OP_DISCARDCHANGES\fP, \fBNC_OP_CREATESUBSCRIPTION\fP, \fBNC_OP_GETSCHEMA\fP, \fBNC_OP_VALIDATE\fP }"
.br
.RI "\fIEnumeration of supported <rpc> operations\&. \fP"
.ti -1c
.RI "enum \fBNC_RPC_TYPE\fP { \fBNC_RPC_UNKNOWN\fP, \fBNC_RPC_HELLO\fP, \fBNC_RPC_DATASTORE_READ\fP, \fBNC_RPC_DATASTORE_WRITE\fP, \fBNC_RPC_SESSION\fP }"
.br
.RI "\fIEnumeration of <rpc> operation types\&. \fP"
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "void \fBnc_filter_free\fP (struct nc_filter *filter)"
.br
.RI "\fIDestroy the filter structure\&. \fP"
.ti -1c
.RI "struct nc_filter * \fBnc_filter_new\fP (\fBNC_FILTER_TYPE\fP type,\&.\&.\&.)"
.br
.RI "\fICreate a new NETCONF filter of the specified type\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_build\fP (const char *rpc_dump, const struct nc_session *session)"
.br
.RI "\fIBuild <rpc> message from the string\&. This is the reverse function of the \fBnc_rpc_dump()\fP\&. \fP"
.ti -1c
.RI "int \fBnc_rpc_capability_attr\fP (\fBnc_rpc\fP *rpc, \fBNC_CAP_ATTR\fP attr,\&.\&.\&.)"
.br
.RI "\fISet the attribute of the given <rpc> which is specific for some NETCONF capability\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_commit\fP (void)"
.br
.RI "\fICreate <commit> NETCONF rpc message\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_copyconfig\fP (\fBNC_DATASTORE\fP source, \fBNC_DATASTORE\fP target,\&.\&.\&.)"
.br
.RI "\fICreate <copy-config> NETCONF rpc message\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_deleteconfig\fP (\fBNC_DATASTORE\fP target,\&.\&.\&.)"
.br
.RI "\fICreate <delete-config> NETCONF rpc message\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_discardchanges\fP (void)"
.br
.RI "\fICreate <discard-changes> NETCONF rpc message\&. \fP"
.ti -1c
.RI "char * \fBnc_rpc_dump\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIDump the rpc message into a string\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_dup\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIDuplicate <rpc> message\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_editconfig\fP (\fBNC_DATASTORE\fP target, \fBNC_DATASTORE\fP source, \fBNC_EDIT_DEFOP_TYPE\fP default_operation, \fBNC_EDIT_ERROPT_TYPE\fP error_option, \fBNC_EDIT_TESTOPT_TYPE\fP test_option,\&.\&.\&.)"
.br
.RI "\fICreate <edit-config> NETCONF rpc message\&. \fP"
.ti -1c
.RI "void \fBnc_rpc_free\fP (\fBnc_rpc\fP *rpc)"
.br
.RI "\fIFree rpc message\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_generic\fP (const char *data)"
.br
.RI "\fICreate a generic NETCONF rpc message with the specified content\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_get\fP (const struct nc_filter *filter)"
.br
.RI "\fICreate <get> NETCONF rpc message\&. \fP"
.ti -1c
.RI "char * \fBnc_rpc_get_config\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet serialized content of the config parameter (<config> itself is not a part of the returned data)\&. This function is valid only for <copy-config> and <edit-config> RPCs\&. \fP"
.ti -1c
.RI "\fBNC_EDIT_DEFOP_TYPE\fP \fBnc_rpc_get_defop\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet default-operation type, valid only for <edit-config> RPCs\&. \fP"
.ti -1c
.RI "\fBNC_EDIT_ERROPT_TYPE\fP \fBnc_rpc_get_erropt\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet error-option type, valid only for <edit-config> RPCs\&. \fP"
.ti -1c
.RI "struct nc_filter * \fBnc_rpc_get_filter\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet filter from <get> or <get-config> RPC\&. \fP"
.ti -1c
.RI "const \fBnc_msgid\fP \fBnc_rpc_get_msgid\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet message-id of the given rpc\&. \fP"
.ti -1c
.RI "char * \fBnc_rpc_get_ns\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet user's rpc operation namespace\&. \fP"
.ti -1c
.RI "\fBNC_OP\fP \fBnc_rpc_get_op\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet operation of the given rpc\&. \fP"
.ti -1c
.RI "char * \fBnc_rpc_get_op_content\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet content of the operation specification from the given rpc\&. \fP"
.ti -1c
.RI "char * \fBnc_rpc_get_op_name\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet operation name of the given rpc\&. \fP"
.ti -1c
.RI "char * \fBnc_rpc_get_op_namespace\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet operation namespace of the given rpc\&. \fP"
.ti -1c
.RI "\fBNC_DATASTORE\fP \fBnc_rpc_get_source\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet the source datastore type (running, startup, candidate) of the rpc request\&. \fP"
.ti -1c
.RI "\fBNC_DATASTORE\fP \fBnc_rpc_get_target\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet the target datastore type (running, startup, candidate) of the rpc request\&. \fP"
.ti -1c
.RI "\fBNC_EDIT_TESTOPT_TYPE\fP \fBnc_rpc_get_testopt\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet test-option type, valid only for <edit-config> RPCs supporting :validate:1\&.1 capability\&. \fP"
.ti -1c
.RI "\fBNC_RPC_TYPE\fP \fBnc_rpc_get_type\fP (const \fBnc_rpc\fP *rpc)"
.br
.RI "\fIGet type of the rpc message\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_getconfig\fP (\fBNC_DATASTORE\fP source, const struct nc_filter *filter)"
.br
.RI "\fICreate <get-config> NETCONF rpc message\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_getschema\fP (const char *name, const char *version, const char *format)"
.br
.RI "\fICreate <get-schema> NETCONF rpc message (RFC 6022)\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_killsession\fP (const char *kill_sid)"
.br
.RI "\fICreate <kill-session> NETCONF rpc message\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_lock\fP (\fBNC_DATASTORE\fP target)"
.br
.RI "\fICreate <lock> NETCONF rpc message\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_unlock\fP (\fBNC_DATASTORE\fP target)"
.br
.RI "\fICreate <unlock> NETCONF rpc message\&. \fP"
.ti -1c
.RI "\fBnc_rpc\fP * \fBnc_rpc_validate\fP (\fBNC_DATASTORE\fP source,\&.\&.\&.)"
.br
.RI "\fICreate <validate> NETCONF rpc message\&. \fP"
.ti -1c
.RI "\fBNC_MSG_TYPE\fP \fBnc_session_recv_rpc\fP (struct nc_session *session, int timeout, \fBnc_rpc\fP **rpc)"
.br
.RI "\fIReceive <rpc> request from the specified NETCONF session\&. This function is supposed to be performed only by NETCONF servers\&. \fP"
.ti -1c
.RI "\fBNC_MSG_TYPE\fP \fBnc_session_send_recv\fP (struct nc_session *session, \fBnc_rpc\fP *rpc, \fBnc_reply\fP **reply)"
.br
.RI "\fISend <rpc> and receive <rpc-reply> via the specified NETCONF session\&. \fP"
.ti -1c
.RI "const \fBnc_msgid\fP \fBnc_session_send_rpc\fP (struct nc_session *session, \fBnc_rpc\fP *rpc)"
.br
.RI "\fISend <rpc> request via specified NETCONF session\&. This function is supposed to be performed only by NETCONF clients\&. \fP"
.in -1c
.SH "Detailed Description"
.PP 
libnetconf's functions for handling NETCONF <rpc> messages\&. 


.SH "Typedef Documentation"
.PP 
.SS "typedef struct nc_msg \fBnc_rpc\fP"

.PP
rpc message\&. 
.SH "Enumeration Type Documentation"
.PP 
.SS "enum \fBNC_CAP_ATTR\fP"

.PP
RPC attributes list\&. List of specific attributes that can be added to selected RPC operations\&. The attributes can be set by (possibly repeated) call of the \fBnc_rpc_capability_attr()\fP function\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fINC_CAP_ATTR_WITHDEFAULTS_MODE \fP\fP
Set <with-default> attribute of the operation 
.SS "enum \fBNC_EDIT_DEFOP_TYPE\fP"

.PP
Enumeration of edit-config's <default-operation> element values\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fINC_EDIT_DEFOP_ERROR \fP\fP
for internal purposes, not defined by NETCONF 
.TP
\fB\fINC_EDIT_DEFOP_NOTSET \fP\fP
follow NETCONF defined default behavior (merge) 
.TP
\fB\fINC_EDIT_DEFOP_MERGE \fP\fP
merge (RFC 6241, sec\&. 7\&.2) 
.TP
\fB\fINC_EDIT_DEFOP_REPLACE \fP\fP
replace (RFC 6241, sec\&. 7\&.2) 
.TP
\fB\fINC_EDIT_DEFOP_NONE \fP\fP
none (RFC 6241, sec\&. 7\&.2) 
.SS "enum \fBNC_EDIT_ERROPT_TYPE\fP"

.PP
Enumeration of edit-config's <error-option> element values\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fINC_EDIT_ERROPT_ERROR \fP\fP
for internal purposes, not defined by NETCONF 
.TP
\fB\fINC_EDIT_ERROPT_NOTSET \fP\fP
follow NETCONF defined default behavior (stop-on-error) 
.TP
\fB\fINC_EDIT_ERROPT_STOP \fP\fP
stop-on-error (RFC 6241, sec\&. 7\&.2) 
.TP
\fB\fINC_EDIT_ERROPT_CONT \fP\fP
continue-on-error (RFC 6241, sec\&. 7\&.2) 
.TP
\fB\fINC_EDIT_ERROPT_ROLLBACK \fP\fP
rollback-on-error (RFC 6241, sec\&. 7\&.2), valid only when :rollback-on-error capability is enabled 
.SS "enum \fBNC_EDIT_OP_TYPE\fP"

.PP
Enumeration of edit-config's operation attribute values\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fINC_EDIT_OP_ERROR \fP\fP
for internal purposes, not defined by NETCONF 
.TP
\fB\fINC_EDIT_OP_MERGE \fP\fP
merge 
.TP
\fB\fINC_EDIT_OP_NOTSET \fP\fP
compatibility value for NC_EDIT_DEFOP_TYPE 
.TP
\fB\fINC_EDIT_OP_REPLACE \fP\fP
replace 
.TP
\fB\fINC_EDIT_OP_CREATE \fP\fP
create 
.TP
\fB\fINC_EDIT_OP_DELETE \fP\fP
delete 
.TP
\fB\fINC_EDIT_OP_REMOVE \fP\fP
remove 
.SS "enum \fBNC_EDIT_TESTOPT_TYPE\fP"

.PP
Enumeration of edit-config's <test-option> element values\&. Valid only with enabled :validate:1\&.1 capability\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fINC_EDIT_TESTOPT_ERROR \fP\fP
for internal purposes, not defined by NETCONF 
.TP
\fB\fINC_EDIT_TESTOPT_NOTSET \fP\fP
follow NETCONF defined default behavior (test-then-set) 
.TP
\fB\fINC_EDIT_TESTOPT_TESTSET \fP\fP
test-then-set 
.TP
\fB\fINC_EDIT_TESTOPT_SET \fP\fP
set 
.TP
\fB\fINC_EDIT_TESTOPT_TEST \fP\fP
test-only 
.SS "enum \fBNC_FILTER_TYPE\fP"

.PP
Enumeration of supported NETCONF filter types\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fINC_FILTER_UNKNOWN \fP\fP
unsupported filter type 
.TP
\fB\fINC_FILTER_SUBTREE \fP\fP
subtree filter according to RFC 6241, sec\&. 6 
.SS "enum \fBNC_OP\fP"

.PP
Enumeration of supported <rpc> operations\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fINC_OP_UNKNOWN \fP\fP
unknown/error value 
.TP
\fB\fINC_OP_GETCONFIG \fP\fP
<get-config> operation 
.TP
\fB\fINC_OP_GET \fP\fP
<get> operation 
.TP
\fB\fINC_OP_EDITCONFIG \fP\fP
<edit-config> operation 
.TP
\fB\fINC_OP_CLOSESESSION \fP\fP
<close-session> operation 
.TP
\fB\fINC_OP_KILLSESSION \fP\fP
<kill-session> operation 
.TP
\fB\fINC_OP_COPYCONFIG \fP\fP
<copy-config> operation 
.TP
\fB\fINC_OP_DELETECONFIG \fP\fP
<delete-config> operation 
.TP
\fB\fINC_OP_LOCK \fP\fP
<lock> operation 
.TP
\fB\fINC_OP_UNLOCK \fP\fP
<unlock> operation 
.TP
\fB\fINC_OP_COMMIT \fP\fP
<commit> operation 
.TP
\fB\fINC_OP_DISCARDCHANGES \fP\fP
<discard-changes> operation 
.TP
\fB\fINC_OP_CREATESUBSCRIPTION \fP\fP
<create-subscription> operation (RFC 5277) 
.TP
\fB\fINC_OP_GETSCHEMA \fP\fP
<get-schema> operation (RFC 6022) 
.TP
\fB\fINC_OP_VALIDATE \fP\fP
<validate> operation 
.SS "enum \fBNC_RPC_TYPE\fP"

.PP
Enumeration of <rpc> operation types\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fINC_RPC_UNKNOWN \fP\fP
value describing that no supported operation type was detected so far 
.TP
\fB\fINC_RPC_HELLO \fP\fP
<hello> message type, same as NC_REPLY_HELLO 
.TP
\fB\fINC_RPC_DATASTORE_READ \fP\fP
<rpc> contains operation reading datastore 
.TP
\fB\fINC_RPC_DATASTORE_WRITE \fP\fP
<rpc> contains operation modifying datastore 
.TP
\fB\fINC_RPC_SESSION \fP\fP
<rpc> contains operation affecting the session 
.SH "Function Documentation"
.PP 
.SS "void nc_filter_free (struct nc_filter *filter)"

.PP
Destroy the filter structure\&. 
.PP
\fBParameters:\fP
.RS 4
\fIfilter\fP Filter to destroy\&. 
.RE
.PP

.SS "struct nc_filter* nc_filter_new (\fBNC_FILTER_TYPE\fPtype, \&.\&.\&.)"

.PP
Create a new NETCONF filter of the specified type\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP Type of the filter\&. 
.br
\fI\&.\&.\&.\fP Filter content:
.IP "\(bu" 2
for \fBNC_FILTER_SUBTREE\fP type, a single variadic parameter \fBconst char* filter\fP is accepted\&. 
.PP
.RE
.PP
\fBReturns:\fP
.RS 4
Created NETCONF filter structure\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_build (const char *rpc_dump, const struct nc_session *session)"

.PP
Build <rpc> message from the string\&. This is the reverse function of the \fBnc_rpc_dump()\fP\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc_dump\fP String containing the NETCONF <rpc> message\&. 
.br
\fIsession\fP Session information needed for ACM\&. If NULL, ACM structure is not prepared and no ACM rules will be applied to the created RPC message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Complete rpc structure used by libnetconf's functions\&. 
.RE
.PP

.SS "int nc_rpc_capability_attr (\fBnc_rpc\fP *rpc, \fBNC_CAP_ATTR\fPattr, \&.\&.\&.)"

.PP
Set the attribute of the given <rpc> which is specific for some NETCONF capability\&. 
.SS "Parameters for specific capability attributes:"
.PP
.IP "\(bu" 2
\fBNC_CAP_ATTR_WITHDEFAULTS_MODE\fP
.IP "  \(bu" 4
applicable to <get>, <get-config> and <copy-config> operations\&.
.IP "  \(bu" 4
Accepts one parameter of \fBNCWD_MODE\fP type, specifying mode of the :with-defaults capability (RFC 6243)\&.
.PP

.PP
.PP
.SS "Examples:"
.PP
.IP "\(bu" 2
nc_rpc_capability_attr(rpc, \fBNC_CAP_ATTR_WITHDEFAULTS_MODE\fP, \fBNCWD_MODE_ALL\fP);
.PP
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP RPC to be modified\&. This RPC must be created by one of the nc_rpc* functions\&. RPC received by the server side's \fBnc_session_recv_rpc()\fP is not accepted\&. 
.br
\fIattr\fP RPC's attribute defined by a capability to be set or changed\&. The list of accepted operations can be found in the description of this function\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success,
.br
 non-zero on error\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_commit (void)"

.PP
Create <commit> NETCONF rpc message\&. 
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_copyconfig (\fBNC_DATASTORE\fPsource, \fBNC_DATASTORE\fPtarget, \&.\&.\&.)"

.PP
Create <copy-config> NETCONF rpc message\&. 
.SS "Variadic parameters:"
.PP
.IP "\(bu" 2
source is specified as \fBNC_DATASTORE_CONFIG\fP:
.IP "  \(bu" 4
\fBnc_rpc_copyconfig()\fP accepts as the first variadic parameter \fBconst char* source_config\fP providing the complete configuration data to copy\&.
.PP

.IP "\(bu" 2
source is specified as \fBNC_DATASTORE_URL\fP:
.IP "  \(bu" 4
\fBnc_rpc_copyconfig()\fP accepts as the first variadic parameter \fBconst char* source_url\fP providing the URL to the file
.PP

.IP "\(bu" 2
target is specified as \fBNC_DATASTORE_URL\fP:
.IP "  \(bu" 4
\fBnc_rpc_copyconfig()\fP accepts as another (first or second according to an eventual previous variadic parameter) variadic parameter \fBconst char* target_url\fP providing the URL to the target file\&.
.PP

.PP
.PP
The file that the url refers to contains the complete datastore, encoded in XML under the element <config> in the 'urn:ietf:params:xml:ns:netconf:base:1\&.0' namespace\&.
.PP
\fBParameters:\fP
.RS 4
\fIsource\fP Source configuration of the datastore type\&. If the \fBNC_DATASTORE_CONFIG\fP is specified, data parameter is used as the complete configuration to copy\&. 
.br
\fItarget\fP Target configuration datastore type to be replaced\&. 
.br
\fI\&.\&.\&.\fP Specific parameters according to the source and target parameters\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_deleteconfig (\fBNC_DATASTORE\fPtarget, \&.\&.\&.)"

.PP
Create <delete-config> NETCONF rpc message\&. 
.PP
\fBParameters:\fP
.RS 4
\fItarget\fP Target configuration datastore type to be deleted\&. 
.br
\fI\&.\&.\&.\fP URL as \fBconst char* url\fP if the target parameter is specified as \fBNC_DATASTORE_URL\fP\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_discardchanges (void)"

.PP
Create <discard-changes> NETCONF rpc message\&. 
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "char* nc_rpc_dump (const \fBnc_rpc\fP *rpc)"

.PP
Dump the rpc message into a string\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
String in XML format containing the NETCONF's <rpc> element and all of its content\&. Caller is responsible for freeing the returned string with free()\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_dup (const \fBnc_rpc\fP *rpc)"

.PP
Duplicate <rpc> message\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP <rpc> message to replicate\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Copy of the given <rpc> message\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_editconfig (\fBNC_DATASTORE\fPtarget, \fBNC_DATASTORE\fPsource, \fBNC_EDIT_DEFOP_TYPE\fPdefault_operation, \fBNC_EDIT_ERROPT_TYPE\fPerror_option, \fBNC_EDIT_TESTOPT_TYPE\fPtest_option, \&.\&.\&.)"

.PP
Create <edit-config> NETCONF rpc message\&. 
.PP
\fBParameters:\fP
.RS 4
\fItarget\fP Target configuration datastore type to be edited\&. 
.br
\fIsource\fP Specifies the type of the source data taken from the variadic parameter\&. Only \fBNC_DATASTORE_CONFIG\fP (variadic parameter contains the <config> data) and \fBNC_DATASTORE_URL\fP (variadic parameter contains URL for <url> element) values are accepted\&. 
.br
\fIdefault_operation\fP Default operation for this request, 0 to skip setting this parameter and use the default server ('merge') behavior\&. 
.br
\fIerror_option\fP Set the response to an error, 0 for the server default behavior\&. 
.br
\fItest_option\fP Set test-option element according to :validate:1\&.1 capability specified in RFC 6241\&. 
.br
\fI\&.\&.\&.\fP According to the source parameter, variadic parameter can be one of the following:
.IP "\(bu" 2
\fBconst char* config\fP defining the content of the <config> element in case the source parameter is specified as \fBNC_DATASTORE_CONFIG\fP
.IP "\(bu" 2
\fBconst char* source_url\fP specifying URL, in case the source parameter is specified as \fBNC_DATASTORE_URL\fP\&. The URL must refer to the file containing configuration data hierarchy to be modified, encoded in XML under the element <config> in the 'urn:ietf:params:xml:ns:netconf:base:1\&.0' namespace\&.
.PP
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "void nc_rpc_free (\fBnc_rpc\fP *rpc)"

.PP
Free rpc message\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message to free\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_generic (const char *data)"

.PP
Create a generic NETCONF rpc message with the specified content\&. Function gets the data parameter and envelopes it into <rpc> container\&. Caller is fully responsible for the correctness of the given data\&.
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP XML content of the <rpc> request to be sent\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_get (const struct nc_filter *filter)"

.PP
Create <get> NETCONF rpc message\&. 
.PP
\fBParameters:\fP
.RS 4
\fIfilter\fP NETCONF filter or NULL if no filter is required\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "char* nc_rpc_get_config (const \fBnc_rpc\fP *rpc)"

.PP
Get serialized content of the config parameter (<config> itself is not a part of the returned data)\&. This function is valid only for <copy-config> and <edit-config> RPCs\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP <copy-config> or <edit-config> rpc message\&.
.RE
.PP
\fBReturns:\fP
.RS 4
Serialized XML or NULL if not available\&. Caller is responsible for freeing the returned string with free()\&. 
.RE
.PP

.SS "\fBNC_EDIT_DEFOP_TYPE\fP nc_rpc_get_defop (const \fBnc_rpc\fP *rpc)"

.PP
Get default-operation type, valid only for <edit-config> RPCs\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP <edit-config> rpc message
.RE
.PP
\fBReturns:\fP
.RS 4
One of the \fBNC_EDIT_DEFOP_TYPE\fP, \fBNC_EDIT_DEFOP_ERROR\fP in case of error\&. 
.RE
.PP

.SS "\fBNC_EDIT_ERROPT_TYPE\fP nc_rpc_get_erropt (const \fBnc_rpc\fP *rpc)"

.PP
Get error-option type, valid only for <edit-config> RPCs\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP <edit-config> rpc message
.RE
.PP
\fBReturns:\fP
.RS 4
One of the \fBNC_EDIT_ERROPT_TYPE\fP, \fBNC_EDIT_ERROPT_ERROR\fP in case of an error 
.RE
.PP

.SS "struct nc_filter* nc_rpc_get_filter (const \fBnc_rpc\fP *rpc)"

.PP
Get filter from <get> or <get-config> RPC\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP <get> or <get-config> rpc message
.RE
.PP
\fBReturns:\fP
.RS 4
pointer to the struct nc_filter or NULL if no filter specified 
.RE
.PP

.SS "const \fBnc_msgid\fP nc_rpc_get_msgid (const \fBnc_rpc\fP *rpc)"

.PP
Get message-id of the given rpc\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
message-id of the given rpc message\&. 
.RE
.PP

.SS "char* nc_rpc_get_ns (const \fBnc_rpc\fP *rpc)"

.PP
Get user's rpc operation namespace\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Namespace URI, NULL in case of error\&. 
.RE
.PP

.SS "\fBNC_OP\fP nc_rpc_get_op (const \fBnc_rpc\fP *rpc)"

.PP
Get operation of the given rpc\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Operation identification of the given rpc message\&. 
.RE
.PP

.SS "char* nc_rpc_get_op_content (const \fBnc_rpc\fP *rpc)"

.PP
Get content of the operation specification from the given rpc\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
String in XML form starting with the operation name element\&. Caller is responsible for freeing the returned string with free()\&. 
.RE
.PP

.SS "char* nc_rpc_get_op_name (const \fBnc_rpc\fP *rpc)"

.PP
Get operation name of the given rpc\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Name of operation in the given rpc message\&. Caller is responsible for freeing the returned string with free()\&. 
.RE
.PP

.SS "char* nc_rpc_get_op_namespace (const \fBnc_rpc\fP *rpc)"

.PP
Get operation namespace of the given rpc\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Namespace of operation in the given rpc message\&. Caller is responsible for freeing the returned string with free()\&. 
.RE
.PP

.SS "\fBNC_DATASTORE\fP nc_rpc_get_source (const \fBnc_rpc\fP *rpc)"

.PP
Get the source datastore type (running, startup, candidate) of the rpc request\&. For <rpc> message that does not affect datastore (e\&.g\&. kill-session), the \fBNC_DATASTORE_ERROR\fP is returned\&.
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message 
.RE
.PP
\fBReturns:\fP
.RS 4
One of the \fBNC_DATASTORE\fP\&. 
.RE
.PP

.SS "\fBNC_DATASTORE\fP nc_rpc_get_target (const \fBnc_rpc\fP *rpc)"

.PP
Get the target datastore type (running, startup, candidate) of the rpc request\&. For <rpc> message that does not affect datastore (e\&.g\&. kill-session), the \fBNC_DATASTORE_ERROR\fP is returned\&.
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message 
.RE
.PP
\fBReturns:\fP
.RS 4
One of the \fBNC_DATASTORE\fP\&. 
.RE
.PP

.SS "\fBNC_EDIT_TESTOPT_TYPE\fP nc_rpc_get_testopt (const \fBnc_rpc\fP *rpc)"

.PP
Get test-option type, valid only for <edit-config> RPCs supporting :validate:1\&.1 capability\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP <edit-config> rpc message
.RE
.PP
\fBReturns:\fP
.RS 4
One of the \fBNC_EDIT_TESTOPT_TYPE\fP, \fBNC_EDIT_TESTOPT_ERROR\fP in case of an error 
.RE
.PP

.SS "\fBNC_RPC_TYPE\fP nc_rpc_get_type (const \fBnc_rpc\fP *rpc)"

.PP
Get type of the rpc message\&. <rpc> message can affect the datastore, the session or it can be unknown for the libnetconf (defined by an unsupported capability or device configuration model)
.PP
\fBParameters:\fP
.RS 4
\fIrpc\fP rpc message 
.RE
.PP
\fBReturns:\fP
.RS 4
One of the \fBNC_RPC_TYPE\fP\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_getconfig (\fBNC_DATASTORE\fPsource, const struct nc_filter *filter)"

.PP
Create <get-config> NETCONF rpc message\&. 
.PP
\fBParameters:\fP
.RS 4
\fIsource\fP Source configuration datastore type being queried\&. 
.br
\fIfilter\fP NETCONF filter or NULL if no filter required\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_getschema (const char *name, const char *version, const char *format)"

.PP
Create <get-schema> NETCONF rpc message (RFC 6022)\&. 
.PP
\fBParameters:\fP
.RS 4
\fIname\fP Identifier for the schema list entry\&. 
.br
\fIversion\fP Optional parameter specifying version of the requested schema\&. 
.br
\fIformat\fP Optional parameter specifying the data modeling language of the schema\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_killsession (const char *kill_sid)"

.PP
Create <kill-session> NETCONF rpc message\&. 
.PP
\fBParameters:\fP
.RS 4
\fIkill_sid\fP ID of session to kill\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_lock (\fBNC_DATASTORE\fPtarget)"

.PP
Create <lock> NETCONF rpc message\&. 
.PP
\fBParameters:\fP
.RS 4
\fItarget\fP Target configuration datastore type to be locked\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_unlock (\fBNC_DATASTORE\fPtarget)"

.PP
Create <unlock> NETCONF rpc message\&. 
.PP
\fBParameters:\fP
.RS 4
\fItarget\fP Target configuration datastore type to be unlocked\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "\fBnc_rpc\fP* nc_rpc_validate (\fBNC_DATASTORE\fPsource, \&.\&.\&.)"

.PP
Create <validate> NETCONF rpc message\&. 
.SS "Variadic parameters:"
.PP
.IP "\(bu" 2
source is specified as \fBNC_DATASTORE_URL\fP:
.IP "  \(bu" 4
\fBnc_rpc_validate()\fP accepts the first variadic parameter \fBconst char* source_url\fP providing the url to the file\&.
.PP

.IP "\(bu" 2
source is specified as \fBNC_DATASTORE_CONFIG\fP:
.IP "  \(bu" 4
\fBnc_rpc_validate()\fP accepts as the first variadic parameter \fBconst char* source_config\fP providing the complete configuration data to copy\&.
.PP

.PP
.PP
\fBParameters:\fP
.RS 4
\fIsource\fP Name of the configuration datastore to validate\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created rpc message\&. 
.RE
.PP

.SS "\fBNC_MSG_TYPE\fP nc_session_recv_rpc (struct nc_session *session, inttimeout, \fBnc_rpc\fP **rpc)"

.PP
Receive <rpc> request from the specified NETCONF session\&. This function is supposed to be performed only by NETCONF servers\&. 
.PP
\fBParameters:\fP
.RS 4
\fIsession\fP NETCONF session to use\&. 
.br
\fItimeout\fP Timeout in microseconds, -1 for infinite timeout, 0 for non-blocking 
.br
\fIrpc\fP Received <rpc> 
.RE
.PP
\fBReturns:\fP
.RS 4
.IP "\(bu" 2
\fBNC_MSG_RPC\fP - success, *rpc points to the received <rpc> message\&.
.IP "\(bu" 2
\fBNC_MSG_HELLO\fP - success, *rpc points to the received <hello> message\&.
.IP "\(bu" 2
\fBNC_MSG_UNKNOWN\fP - error occurred
.IP "\(bu" 2
\fBNC_MSG_WOULDBLOCK\fP - receiving timeouted without any received message\&. 
.PP
.RE
.PP

.SS "\fBNC_MSG_TYPE\fP nc_session_send_recv (struct nc_session *session, \fBnc_rpc\fP *rpc, \fBnc_reply\fP **reply)"

.PP
Send <rpc> and receive <rpc-reply> via the specified NETCONF session\&. 
.PP
\fBParameters:\fP
.RS 4
\fIsession\fP NETCONF session to use\&. 
.br
\fIrpc\fP RPC message to send\&. 
.br
\fIreply\fP Received <rpc-reply> 
.RE
.PP
\fBReturns:\fP
.RS 4
.IP "\(bu" 2
\fBNC_MSG_REPLY\fP - success, *reply points to the received <rpc-reply> message\&.
.IP "\(bu" 2
\fBNC_MSG_NONE\fP - success, but <rpc-reply> with error information was processed automatically using callback specified with \fBnc_callback_error_reply()\fP function\&. *reply was not changed\&.
.IP "\(bu" 2
\fBNC_MSG_UNKNOWN\fP - error occurred 
.PP
.RE
.PP

.SS "const \fBnc_msgid\fP nc_session_send_rpc (struct nc_session *session, \fBnc_rpc\fP *rpc)"

.PP
Send <rpc> request via specified NETCONF session\&. This function is supposed to be performed only by NETCONF clients\&. This function IS thread safe\&.
.PP
\fBParameters:\fP
.RS 4
\fIsession\fP NETCONF session to use\&. 
.br
\fIrpc\fP <rpc> message to send\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
0 on error,
.br
 message-id of sent message on success\&. 
.RE
.PP

.SH "Author"
.PP 
Generated automatically by Doxygen for libnetconf from the source code\&.
